<template>
  <div class="container">
    <div>
      <el-row :gutter="25">
        <el-col :span="6">
          <el-form ref="form" :model="form">
            <el-form-item label="餐饮单位名称：">
              <el-input
                v-model="select.name"
                placeholder="请输入餐饮单位名称"
                style="width: 10.813vw"
              ></el-input>
            </el-form-item>
          </el-form>
        </el-col>
        <el-col :span="14">
          <el-form ref="form" :model="form" style="float: left">
            <el-form-item>
              <el-button size="mini" type="primary" @click="screeningData"
                >查 询</el-button
              >
              <!-- <el-button size="mini" type="success" @click="handleAdd"
                >新 增</el-button
              > -->

              <!-- <el-button style="padding: 0; border: 0">
                <el-upload
                  action="/上传文件的接口"
                  :on-change="onChange"
                  :auto-upload="false"
                  :show-file-list="false"
                  accept=".xls, .xlsx"
                  class="upload"
                >
                  <el-button size="mini" type="success">导 入</el-button>
                </el-upload>
              </el-button> -->
              <el-button size="mini" type="warning" @click="exportExcel"
                >导 出</el-button
              >
            </el-form-item>
          </el-form>
        </el-col>
      </el-row>
    </div>
    <el-table
    v-loading="loading"
      highlight-current-row
      style="width: 100%"
      :data="
        tableData.slice((currentPage - 1) * pageSize, currentPage * pageSize)
      "
      fit
      border
      @row-dblclick="dblClickRow"
      @cell-mouse-enter="cellMouseEnter"
    >
      <!-- 名称	油脂类型	日产生量	负责人	电话	职务	ID -->
      <!-- <el-table-column  prop="ID" label="编号" align="center" ></el-table-column> -->
      <el-table-column
        prop="名称"
        label="餐饮单位名称"
        align="center"
         width="350"
      ></el-table-column>
      <!-- <el-table-column  prop="CLIENT_NO" label="组织编号" align="center" ></el-table-column>
      <el-table-column  prop="LONGITUDE" label="经度" align="center" ></el-table-column>
      <el-table-column  prop="LATITUDE" label="纬度" align="center" ></el-table-column> -->
      <el-table-column
        prop="油脂类型"
        label="油脂类型"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="日产生量"
        label="月产生量"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="负责人"
        label="负责人"
        align="center"
      ></el-table-column>
      <!-- <el-table-column  prop="IDCARD" label="身份证" align="center" ></el-table-column> -->
      <el-table-column
        prop="电话"
        label="联系电话"
        align="center"
      ></el-table-column>
      <!-- <el-table-column
        prop="职务"
        label="职务"
        align="center"
        width="100"
      ></el-table-column> -->
      <!-- <el-table-column  prop="TYPE_NAME" label="收运类型" align="center" ></el-table-column> -->
      <!-- <el-table-column  prop="DID" label="收运司机编号" align="center" ></el-table-column> -->
      <!-- <el-table-column  prop="DNAME" label="收运司机" align="center" ></el-table-column> -->
      <!-- <el-table-column  prop="VID" label="收运车辆编号" align="center" ></el-table-column> -->
      <!-- <el-table-column  prop="LICENSE_PLATE" label="收运车辆" align="center" ></el-table-column>
      <el-table-column  prop="ISUSE" label="是否在用" align="center" :formatter="formatterIsuse"></el-table-column> -->
      <el-table-column label="操作" align="center" width="100">
        <template slot-scope="scope">
          <el-button type="text" @click="handleEdit(scope.$index, scope.row)"
            >编辑</el-button
          >
          <!-- <el-button
            type="text"
            @click="handleDelete(scope.$index, scope.row)"
            style="color: red"
            >删除</el-button
          > -->
        </template>
      </el-table-column>
    </el-table>
    <div class="pagination">
      <el-pagination
        background
        layout="total, sizes, prev, pager, next, jumper"
        :current-page="currentPage"
        :page-size="pageSize"
        :total="tableData.length"
        @size-change="handleSizeChange"
        @current-change="handlePageChange"
      ></el-pagination>
    </div>

    <!-- 弹出框 新增 -->
    <el-dialog
      title="新增餐饮单位信息"
      :visible.sync="isVisibleAdd"
      width="60%"
      :modal="false"
      append-to-body
    >
      <el-form ref="form" :model="form" label-width="7.2vw" class="flex">
        <el-form-item label="餐饮单位名称：" class="wid50">
          <el-input
            v-model="form.NAME"
            placeholder="请输入餐饮单位名称"
            class="handle-input mr10"
          ></el-input>
        </el-form-item>
        <el-form-item label="负责人：" class="wid50">
          <el-input
            v-model="form.LEADER"
            placeholder="请输入负责人"
            class="handle-input mr10"
          ></el-input>
        </el-form-item>
        <!-- <el-form-item label="负责人身份证：" class="wid50">
          <el-input
            v-model="form.IDCARD"
            placeholder="请输入负责人身份证 "
            class="handle-input mr10"
          ></el-input>
        </el-form-item> -->
        <el-form-item label="联系电话：" class="wid50">
          <el-input
            v-model="form.PHONE"
            placeholder="请输入联系电话 "
            class="handle-input mr10"
          ></el-input>
        </el-form-item>
        <!-- <el-form-item label="负责人职务：" class="wid50">
          <el-input
            v-model="form.JOB"
            placeholder="请输入负责人职务 "
            class="handle-input mr10"
          ></el-input>
        </el-form-item> -->
        <el-form-item label="账户：" class="wid50">
          <el-input
            v-model="form.UID"
            placeholder="请输入账户名称 "
            class="handle-input mr10"
          ></el-input>
        </el-form-item>
        <el-form-item label="密码：" class="wid50">
          <el-input
            v-model="form.PWD"
            placeholder="请输入账户密码"
            class="handle-input mr10"
          ></el-input>
        </el-form-item>
        <el-form-item label="经度：" class="wid50">
          <el-input
            v-model="form.LONGITUDE"
            placeholder="请输入经度"
            class="handle-input mr10"
          ></el-input>
        </el-form-item>
        <el-form-item label="纬度：" class="wid50">
          <el-input
            v-model="form.LATITUDE"
            placeholder="请输入纬度"
            class="handle-input mr10"
          ></el-input>
        </el-form-item>

        <el-form-item label="月产生量：" class="wid50">
          <el-input
            v-model="form.OLLNUM"
            placeholder="请输入月产生量"
            class="handle-input mr10"
          ></el-input>
        </el-form-item>
        <el-form-item label="油脂类型：" class="wid50">
          <el-select multiple v-model="form.arrOil" placeholder="请选择">
            <el-option
              v-for="item in OILTYPE"
              :key="item.OILindex"
              :label="item.OILtitle"
              :value="item.OILindex"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="所属区域：" class="wid50">
          <el-select
            v-model="form.CLIENT_NO"
            value-key="id"
            placeholder="请选择"
          >
            <el-option
              v-for="item in selectClientInfoList"
              :key="item.CLIENT_NO"
              :label="item.CLIENT_NAME"
              date-name="item.CLIENT_NAME"
              :value="item.CLIENT_NO"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="收运类型：" class="wid50">
          <el-select
            v-model="form.TYPE"
            placeholder="请选择"
          >
            <el-option
              v-for="item in type"
              :key="item.typeindex"
              :label="item.typetitle"
              :value="item.typeindex"
              @change="changType"
            >
            </el-option>
          </el-select>
        </el-form-item> -->
        <!-- <el-form-item label="收运司机：" class="wid50">
          <el-input
            v-model="form.DID"
            placeholder="请输入收运司机 "
            class="handle-input mr10"
          ></el-input>
        </el-form-item> -->
        <!-- <el-form-item label="收运司机姓名：" class="wid50">
          <el-input
            v-model="form.DNAME"
            placeholder="请输入收运司机姓名 "
            class="handle-input mr10"
          ></el-input>
        </el-form-item> -->
        <!-- <el-form-item label="收运车辆：" class="wid50">
          <el-input
            v-model="form.VID"
            placeholder="请输入收运车辆 "
            class="handle-input mr10"
          ></el-input>
        </el-form-item> -->
        <!-- <el-form-item label="是否在用：" class="wid50">
          <el-select
            v-model="form.ISUSE"
            placeholder="请选择"
          >
            <el-option
              v-for="item in ISUSE"
              :key="item.rolelevelindex"
              :label="item.roleleveltitle"
              :value="item.rolelevelindex"
            >
            </el-option>
          </el-select>
        </el-form-item> -->

        <!-- <el-form-item label="收运车辆牌照：" class="wid50" >
            <el-button size="mini" type="success" @click="clickVehicle">
            <span v-if="this.VehicleUrl">重新上传</span>
            <span v-else>上传图片</span>
        </el-button>
        <span style="margin-left:50px">{{this.VehicleUrl}}</span>
        <input type="file" ref="VehicleFile" style="display:none" accept="image/gif, image/jpeg" @change="changeVehicle"/>
        </el-form-item> -->
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="isVisibleAdd = false">取 消</el-button>
        <el-button type="primary" @click="saveAdd()">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 弹出框 -->
    <el-dialog
      title="编辑餐饮单位信息"
      :visible.sync="isVisibleEdit"
      width="60%"
      :modal="false"
      append-to-body
    >
      <el-form ref="form" :model="form" label-width="7.2vw" class="flex">
        <el-form-item label="餐饮单位名称：" class="wid50">
          <el-input
            v-model="form.名称"
            placeholder="请输入餐饮单位名称"
            class="handle-input mr10"
          ></el-input>
        </el-form-item>
        <el-form-item label="负责人：" class="wid50">
          <el-input
            v-model="form.负责人"
            placeholder="请输入负责人"
            class="handle-input mr10"
          ></el-input>
        </el-form-item>
        <el-form-item label="联系电话：" class="wid50">
          <el-input
            v-model="form.电话"
            placeholder="请输入联系电话 "
            class="handle-input mr10"
          ></el-input>
        </el-form-item>
        <!-- <el-form-item label="负责人职务：" class="wid50">
          <el-input
            v-model="form.职务"
            placeholder="请输入负责人职务 "
            class="handle-input mr10"
          ></el-input>
        </el-form-item> -->
        <!-- <el-form-item label="账户：" class="wid50">
          <el-input
            v-model="form.UID"
            placeholder="请输入账户名称 "
            class="handle-input mr10"
          ></el-input>
        </el-form-item> -->
        <!-- <el-form-item label="密码：" class="wid50">
          <el-input
            v-model="form.PWD"
            placeholder="请输入账户密码"
            class="handle-input mr10"
          ></el-input>
        </el-form-item> -->
        <el-form-item label="所属区域：" class="wid50">
          <el-select
            v-model="form.CLIENT_NO"
            value-key="id"
            placeholder="请选择"
          >
            <el-option
              v-for="item in selectClientInfoList"
              :key="item.CLIENT_NO"
              :label="item.CLIENT_NAME"
              date-name="item.CLIENT_NAME"
              :value="item.CLIENT_NO"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="经度：" class="wid50">
          <el-input
            v-model="form.LONGITUDE"
            placeholder="请输入经度"
            class="handle-input mr10"
          ></el-input>
        </el-form-item>
        <el-form-item label="纬度：" class="wid50">
          <el-input
            v-model="form.LATITUDE"
            placeholder="请输入纬度"
            class="handle-input mr10"
          ></el-input>
        </el-form-item>
        <el-form-item label="月产生量：" class="wid50">
          <el-input
            v-model="form.日产生量"
            placeholder="请输入月产生量"
            class="handle-input mr10"
          ></el-input>
        </el-form-item>
        <el-form-item label="油脂类型：" class="wid50">
          <el-select multiple v-model="form.油脂类型" placeholder="请选择">
            <el-option
              v-for="item in OILTYPE"
              :key="item.OILindex"
              :label="item.OILtitle"
              :value="item.OILindex"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="isVisibleEdit = false">取 消</el-button>
        <el-button type="primary" @click="saveEdit()">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import '@/assets/css/common.css'

import export2Excel from '@/utils/exportExcel/index.js'
import OSS from 'ali-oss';
import { time } from 'echarts';
import eventBus from '@/eventBus.js'


export default {
  data () {

    return {
      loading: false,
      clientData: [],
      currentPage: 1, //初始页
      pageSize: 10,    //    每页的数据
      originalData: [],
      tableData: [],
      selectClientInfoList: [],
      expireData: [],
      select: {
        name: ''
      },
      isVisibleAdd: false,
      isVisibleEdit: false,
      showBigDialogDate: true,
      selectClientInfoList: [],
      OILTYPE: [{
        OILtitle: '煎炸油',
        OILindex: '1'
      },
      {
        OILtitle: '隔离油',
        OILindex: '2'
      },
      {
        OILtitle: '动物油',
        OILindex: '3'
      },
      {
        OILtitle: '潲水油',
        OILindex: '4'
      },
      {
        OILtitle: '地沟油',
        OILindex: '5'
      }, {
        OILindex: '0',
        OILtitle: '其他'
      }],
      type: [{
        typetitle: '固定收运',
        typeindex: '1'
      },
      {
        typetitle: '抢单收运',
        typeindex: '2'
      }],
      ISUSE: [{
        roleleveltitle: '是',
        rolelevelindex: 1
      }, {
        roleleveltitle: '否',
        rolelevelindex: 0
      },],
      form: {
        DW: "",
        CPH: "",
        MODEL: "",
        PERSON: "",
        BUYTIME: "",
        EXPLAIN: "",
        USEDEPTNAME: "",
        USEDEPTID: "",
        VOWNER: "",
        BRAND: "",
        VIN: "",
        ENGINENUM: "",
        DISCHARGERATE: "",
        VCONDITION: "",
        PRICE: "",
        CLIENT_NO: [],
        USE: "",
      },
      showBigDialogVisible: false,
      srcBig: '',
      //图片上传
      fileList: [],
      VehicleUrl: '', //存上传后的垃圾点图片url
      CBPicUrl: '', //存上传后的车本图片url
      dataObj: {
        region: 'oss-cn-beijing',//我的存储是北京，可根据具体配置自行修改
        accessKeyId: 'LTAISI12uxTRFccz',
        accessKeySecret: 'cQAvLIZ9JizT5RXRNPBVcXfg3iURD8',
        bucket: 'photo-srw-hb2',
      }, //存签名信息
      baseAli: 'oss-cn-beijing.aliyuncs.com',
    }
  },
  created () {
    if (localStorage.getItem('CTYPE') == '0') {
      this.rolelevel.shift()
    } else if (localStorage.getItem('CTYPE') != '-1') {
      this.rolelevel = []
    }
    this.getClientRoleList()
  },
  mounted () {
    this.getlistdata()
  },
  methods: {
    // 获取所属区域名
    async getClientRoleList () {
      var url = 'VehicleOil/GetGroupingModelsApi?CLIENT_NO=' + localStorage.getItem('CLIENT_NO')
      const { data } = await this.$Http.get(url)
      this.selectClientInfoList = data
    },
    // 给所属区域名称下拉列表传值
    // changType () {
    //   if (this.form.TYPE == '2') {
    //     this.form.DID = '0',
    //       this.form.VID = '0'
    //   }
    // },
    change (e) {
      this.$forceUpdate()
    },
    // 导入Excel
    onChange (file, fileList) {
      //  console.log(fileList);
      this.fileData = file; // 保存当前选择文件
      this.readExcel(); // 调用读取数据的方法
    },
    // 读取数据
    readExcel (e) {
      let that = this;
      const files = that.fileData;
      console.log(files);
      if (!files) {
        //如果没有文件
        return false;
      } else if (!/\.(xls|xlsx)$/.test(files.name.toLowerCase())) {
        this.$message.error("上传格式不正确，请上传xls或者xlsx格式");
        return false;
      }
      const fileReader = new FileReader();
      console.log(fileReader)
      fileReader.onload = ev => {
        try {
          const data = ev.target.result;
          //  console.log(ev.target)
          //  console.log(this);
          const workbook = this.XLSX.read(data, {
            type: "binary"// 以字符编码的方式解析
          });

          if (workbook.SheetNames.length >= 1) {
            //  this.$message({
            //    message: "导入数据表格成功",
            //    showClose: true,
            //    type: "success"
            //  });

            const wsname = workbook.SheetNames[0]; //取第一张表
            const ws = this.XLSX.utils.sheet_to_json(workbook.Sheets[wsname]); //生成json表格内容
            console.log(ws)
            this.inputExcelDataLength = ws.length
            this.fullscreenLoading = this.$loading({
              lock: true,
              text: 'Loading',
              spinner: 'el-icon-loading',
              background: 'rgba(0, 0, 0, 0.7)'
            })
            for (let i = 0, len = ws.length; i < len; i++) {
              var item = ws[i]
              // if (item['油脂类型'] == '煎炸油') {
              //   item['油脂类型'] = '1'
              // } else if (item['油脂类型'] == '隔离油') {
              //   item['油脂类型'] = '2'
              // } else if (item['油脂类型'] == '动物油') {
              //   item['油脂类型'] = '3'
              // } else if (item['油脂类型'] == '潲水油') {
              //   item['油脂类型'] = '4'
              // } else if (item['油脂类型'] == '地沟油') {
              //   item['油脂类型'] = '5'
              // } else {
              //   item['油脂类型'] = '0'
              // }
              // if(item['收运类型'] == '固定收运'){
              //   item['收运类型'] = '1'
              // }else if(item['收运类型'] == '抢单收运'){
              //   item['收运类型'] = '2'
              // }
              this.addWeight(item)
            }
          } else {
            this.$message.error("未读取到表格内容");
          }
        } catch (e) {
          return false;
        }
      };
      // 如果为原生 input 则应是 files[0]
      fileReader.readAsBinaryString(files.raw);
    },
    async addWeight (item) {
      this.$axios({
        url: 'VehicleOil/AddPlacePoint',
        method: 'post',
        data: {
          NAME: item['餐饮单位名称'],
          LONGITUDE: item['经度'],
          LATITUDE: item['纬度'],
          OIL_TYPE: item['油脂类型'],
          OLLNUM: item['月产生量'],
          CLIENT_NO: item['组织编号'],
          LEADER: item['负责人'],
          //  IDCARD: item['负责人身份证'],
          PHONE: item['联系电话'],
          // JOB: item['负责人职务'],
          //  ISUSE: item['是否在用'],
          //  TYPE: item['收运类型'],
           UID: item['账户'],
           PWD: item['密码'],
        }
      }).then(res => {
        console.log(res)
        this.inputExcelDataIndex++
        if (res.data.IsSucess) {
          this.fullscreenLoading.close()
          this.$message.success('表格文件导入成功')
          this.getlistdata()
        } else {
          this.fullscreenLoading.close()
          this.$message.error('表格文件导入失败' + '，' + res.data.Message);

        }
        if (this.inputExcelDataIndex == this.inputExcelDataLength) {
          this.fullscreenLoading.close()
          if (this.strError.length == 0) {
            this.$message.success('表格文件导入成功')
          } else {
            // this.$message.error('表格文件导入结束<br/>' + this.strError);
            this.$message({
              message: '表格文件导入结束，' + this.strError,
              type: 'error',
              duration: 5000
            })
          }
          this.getlistdata()
        }
      })
      //   })
    },
    // formatterIsuse (row, column, cellValue, index) {
    //   if (cellValue == 1) {
    //     return '是'
    //   } else {
    //     return '否'
    //   }
    // },
    // 导出Excel
    exportExcel () {
      let excelName = '餐饮单位信息'
      const tHeader = ['餐饮单位编号', '餐饮单位名称','油脂类型', '月产生量', '负责人', '联系电话']
      const filterVal = ['ID', '名称', '油脂类型', '日产生量', '负责人', '电话']
      export2Excel(tHeader, filterVal, this.tableData, excelName)
    },
    // 打开新增窗口
    handleAdd () {
      //清空编辑框
      this.form = {}
      //展示窗口
      this.isVisibleAdd = true;
      // this.idEdit = false;
    },
    // 新增保存
    async saveAdd () {
      var str = '';
      this.form.arrOil.forEach(element => {
        str = str + element + '、'
      });
      str = str.substring(0, str.length -1);
      this.form.OIL_TYPE = str
      // console.log(this.addform)
      this.$axios({
        url: 'VehicleOil/AddPlacePoint',
        method: 'post',
        data: {
          NAME: this.form.NAME,
          CLIENT_NO: this.form.CLIENT_NO,
          LATITUDE: this.form.LATITUDE,
          LONGITUDE: this.form.LONGITUDE,
          OIL_TYPE: this.form.OIL_TYPE,
          OLLNUM: this.form.OLLNUM,
          IDCARD: '',
          LEADER: this.form.LEADER,
          PHONE: this.form.PHONE,
          JOB: this.form.JOB,
          ISUSE: this.form.ISUSE,
          TYPE: '1',
          DID: '',
          VID: '',
        },
      }).then((res) => {
        console.log(this.data)
        console.log(res)
        if (res.data.IsSucess) {
          this.$message.success('新增成功');
          this.isVisibleAdd = false
          this.getlistdata()
        } else {
          this.$message.error('新增失败');
        }
      })
    },
    // 打开编辑窗口
    handleEdit (index, row) {
      this.form = Object.assign({}, row);
      var arrOil = []
      if (this.form.油脂类型.indexOf("其他") != -1) {
        arrOil.push('0')
      }
      if (this.form.油脂类型.indexOf("煎炸油") != -1) {
        arrOil.push('1')
      }
      if (this.form.油脂类型.indexOf("隔离油") != -1) {
        arrOil.push('2')
      }
      if (this.form.油脂类型.indexOf("动物油") != -1) {
        arrOil.push('3')
      }
      if (this.form.油脂类型.indexOf("潲水油") != -1) {
        arrOil.push('4')
      }
      if (this.form.油脂类型.indexOf("地沟油") != -1) {
        arrOil.push('5')
      }
      this.form.油脂类型 = arrOil;
      this.isVisibleEdit = true;
    },
    // 保存编辑
    async saveEdit () {
      var str = '';
      this.form.油脂类型.forEach(element => {
        str = str + element + '、'
      });
      str = str.substring(0, str.length -1);
      this.form.油脂类型 = str

      console.log(this.form)
      this.$axios({
        url: 'VehicleOil/UpdataPlacePoint',
        method: 'post',
        data: {
          ID: this.form.ID,
          LATITUDE: this.form.LATITUDE,
          LONGITUDE: this.form.LONGITUDE,
          CLIENT_NO: this.form.CLIENT_NO,
          NAME: this.form.名称,
          OIL_TYPE: this.form.油脂类型,
          OLLNUM: this.form.日产生量,
          LEADER: this.form.负责人,
          PHONE: this.form.电话,
          JOB: this.form.职务,
        },
      }).then((res) => {
        if (res.data.IsSucess) {
          this.$message.success('编辑成功');
          this.isVisibleEdit = false
          this.getlistdata()
        } else {
          this.$message.error('编辑失败');
        }
      })
    },
    // 删除垃圾点信息
    async handleDelete (index, row) {
      const confirmResult = await this.$confirm('确定删除？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).catch(err => err)
      if (confirmResult == 'confirm') {
        const params = {
          ID: row.ID,
        }
        const { data } = await this.$Http.get('VehicleOil/DeletePlacePoint', { params })
        if (data.IsSucess) {
          this.$message.success('删除成功')
          this.isVisibleAdd = false
          this.getlistdata()
        } else {
          this.$message.error('删除失败');
        }
      } else {
        this.$message.info('取消删除')
        this.isVisibleAdd = false
      }

    },
    //获取垃圾点列表
    async getlistdata () {
      this.loading = true;
      var url = 'VehicleOil/getPlacePoint?CLIENT_NO=' + localStorage.getItem('CLIENT_NO')
      const { data } = await this.$Http.get(url)
      this.originalData = data
      this.screeningData()
      this.loading = false;
    },
    // 模糊查询
    screeningData () {
      this.currentPage = 1;
      this.tableData = this.originalData
      if (this.select.name) this.tableData = this.tableData.filter(item => item.名称.includes(this.select.name))
      // console.log(this.select.name)
      eventBus.$emit('mapData_Point', this.tableData)
    },
    // 分页导航
    handlePageChange (currentPage) {
      this.currentPage = currentPage;
      // console.log(this.currentPage)
      // this.$set(this.query, 'pageIndex', val);
      // this.getlistdata();
    },
    handleSizeChange (size) {
      this.pageSize = size;
      console.log(this.pageSize)
    },
    // 放大图片
    bigImage (row) {
      this.srcBig = row.VehiclePicPath
      this.showBigDialogVisible = true
    },
    handleClose () {
      this.showBigDialogVisible = false;
    },
    // 限制用户上传的图片格式和大小
    beforeAvatarUpload (file) {
      const isJPG = file.type === 'image/jpeg';
      const isLt2M = file.size / 1024 / 1024 < 2
      if (!isJPG) {
        this.$message.error('上传头像图片只能是 JPG 格式!');
      }
      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!');
      }
      return isJPG && isLt2M;
    },
    // 点击上传垃圾点图片按钮
    clickVehicle () {
      this.$refs.VehicleFile.click();

    },
    changeVehicle () {
      this.afterRead1(this.$refs.VehicleFile.files[0]);
      this.$refs.VehicleFile.value = null; // 移除文件，可以保证上传同样的文件时，也会触发change事件
    },
    // 上传垃圾点图片
    afterRead1 (file) {
      return new Promise((resolve, reject) => {
        // 此时可以自行将文件上传至服务器
        const that = this
        let client = new OSS(this.dataObj)
        const fileName = file.name
        //定义唯一的文件名，打印出来的uid其实就是时间戳
        //client 是第一步中的 client
        client
          .multipartUpload(fileName, file)
          .then((result) => {
            //下面是如果对返回结果再进行处理，根据项目需要
            // console.log(result)
            that.VehicleUrl =
              'http://' +
              result.bucket +
              '.' +
              that.baseAli +
              '/' +
              result.name
            console.log(that.VehicleUrl)
            resolve()
          })
          .catch((err) => {
            console.log('err:', err)
            reject()
          })
      })
    },

    // 点击上传车本图片按钮
    clickCBPic () {
      this.$refs.CBPicFile.click();

    },
    changeCBPic () {
      this.afterRead2(this.$refs.CBPicFile.files[0]);
      this.$refs.CBPicFile.value = null; // 移除文件，可以保证上传同样的文件时，也会触发change事件
    },
    // 上传车本图片
    afterRead2 (file) {
      return new Promise((resolve, reject) => {
        // 此时可以自行将文件上传至服务器
        const that = this
        let client = new OSS(this.dataObj)
        const fileName = file.name
        //定义唯一的文件名，打印出来的uid其实就是时间戳
        //client 是第一步中的 client
        client
          .multipartUpload(fileName, file)
          .then((result) => {
            //下面是如果对返回结果再进行处理，根据项目需要
            // console.log(result)
            that.CBPicUrl =
              'http://' +
              result.bucket +
              '.' +
              that.baseAli +
              '/' +
              result.name
            console.log(that.CBPicUrl)
            resolve()
          })
          .catch((err) => {
            console.log('err:', err)
            reject()
          })
      })
    },
    afterRead (file) {
      return new Promise((resolve, reject) => {
        // 此时可以自行将文件上传至服务器
        const that = this
        let client = new OSS(this.dataObj)
        const fileName = file.name
        //定义唯一的文件名，打印出来的uid其实就是时间戳
        //client 是第一步中的 client
        client
          .multipartUpload(fileName, file)
          .then((result) => {
            //下面是如果对返回结果再进行处理，根据项目需要
            // console.log(result)
            that.tempUrl =
              'http://' +
              result.bucket +
              '.' +
              that.baseAli +
              '/' +
              result.name
            console.log(that.tempUrl)
            resolve()
          })
          .catch((err) => {
            console.log('err:', err)
            reject()
          })
      })
    },
    handleAvatarSuccess (res, file) {
      this.imageUrl = URL.createObjectURL(file.raw)
    },
    // 鼠标进入单元格显示其内容
    cellMouseEnter (row, column, cell, event) {
      cell.setAttribute('title', cell.innerText)
    },
    // 双击表格某一行
    dblClickRow (row) {
      eventBus.$emit('mapDBrowPoint', row)
    },
  }
}
</script>
<style>
.container {
  overflow-y: auto;
  height: calc(100% - 50px);
  border: 0px;
}
.el-col-6 {
  min-width: 400px;
  min-height: 50px;
}
.el-table th {
  height: 40px;
}

/* .el-upload--text {
  width: 300px;
} */
.el-select__tags {
  top: 5px;
  transform: none;
  /* transform: translateY(-50%);
  -webkit-transform: translateY(-50%); */
  -webkit-transform: none;
}
</style>